package com.example.ivideo_2201

import android.widget.Toast
import com.alibaba.android.arouter.BuildConfig
import com.alibaba.android.arouter.launcher.ARouter
import com.example.ivideo_2201.test.MathUtil
import com.example.lib_common.BaseApplication
import com.example.lib_common.mmkv.AppMMKV
import com.example.lib_common.utils.LoggerUtils
import com.example.lib_common.websocket.WebSocketUtils

import com.tencent.bugly.crashreport.CrashReport
import com.tencent.mmkv.MMKV
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import org.java_websocket.handshake.ServerHandshake
import java.lang.Exception
import java.util.concurrent.Executors

/**
 * @author yaotianxue
 * @description
 * @date 2024/10/21
 */
class App:BaseApplication() {


    override fun onCreate() {
        super.onCreate()
        initRoom()
        initMMKV()
        initArouter()
        initBugly()
        initPreUmeng()

        LoggerUtils.d("app","app被创建hhahahaslslksklslkdskldklsd")

        println(123)

        initWebSocket(object : WebSocketUtils.ReceiveMsgListener {
            override fun onReceive(message: String?) {
                //发送通知
                Toast.makeText(this@App,"发送通知 $message",Toast.LENGTH_SHORT).show()
            }

            override fun onOpen(handshakedata: ServerHandshake?) {

            }

            override fun onError(ex: Exception?) {

            }

            override fun onClose(code: Int, reason: String?, remote: Boolean) {

            }

        })
//        //制造异常
//        val result = MathUtil.chu(10,0)
//        LoggerUtils.d("app","result $result")

//        //初始化注册生成路由表
//        Router.getInstance().register("/main/SplashActivity",SplashActivity::class.java)
//        Router.getInstance().register("/live/LiveActivity",LiveActivity::class.java)
    }
}